import {
  Spin,
  DataSet,
  Form,
  TextField,
  Button,
} from 'choerodon-ui/pro';
import React, { useMemo } from 'react';
import spinDS from './spinDataSet';



const spinNested: React.FC = (): React.ReactElement => {

  const spinDataSet: DataSet = useMemo(() => new DataSet(spinDS()), []);

  return (
    <Spin dataSet={spinDataSet}>
      <Form header="刷新表单" dataSet={spinDataSet}>
        <TextField name="userid" />
        <TextField name="name" />
      </Form>
      <div>
        <Button onClick={() => spinDataSet.query()}>
          点击触发DS查询
        </Button>
      </div>
    </Spin>
  );
};

export default spinNested;